/*
 * Driver LCD Hitachi 44780
 * lcd.h
 
 * Created on: 13/04/2011
 * Author: Leandro Perez Guatibonza
 */

#ifndef LCD_H
#define LCD_H

/*
 * Constant Section
 */
#define LCD_E    0
#define LCD_RS   1
#define LCD_D7   2
#define LCD_D6   3
#define LCD_D5   4
#define LCD_D4   5

#define LCD_INSTRU 0
#define LCD_DATA   1

#define LCD_NUMCOL 16
#define LCD_NUMROW 2

#define LCD_SCROLL_LEFT    0
#define LCD_SCROLL_RIGHT   1

#define LCD_FORMAT_BIN     0
#define LCD_FORMAT_OCT     1
#define LCD_FORMAT_HEX     2
#define LCD_FORMAT_DEC     3

#define LCD_INSTRU_CLEAR      0x01
#define LCD_INSTRU_HOME       0x02
#define LCD_INSTRU_CURSOR_ON  0x06
#define LCD_INSTRU_CURSOR_OFF 0x00

/*
 * Function LCD Section
 */
// Initialize LCD
void lcdInit();

// Send command or data to LCD
void lcdSend(unsigned char typeOrder, unsigned char dataLCD);

// Clean LCD screen
void lcdClear();

// Sets the LCD cursor Home position
void lcdHome();

// Set the cursor position of LCD
void lcdSetCursor(unsigned char column, unsigned char row);

// Set the cursor blink in the LCD
void lcdBlinkCursor(unsigned char booleanState);

// Set whether the cursor on the LCD is visible
void lcdVisibleCursor(unsigned char booleanState);

// Set if the LCD is turned on or turn off
void lcdStateDisplay(unsigned char booleanState);
 
// Set the scroll direction of the LCD
void lcdDirectionScroll(unsigned char directionScroll);

// Set the autoscroll of the LCD
void lcdAutoScroll(unsigned char booleanState);

// Create a character on the LCD DDRAM
void lcdCreateCharacter(unsigned char dirDDRAMLCD, unsigned char *patternPtr);

// Prints a variable in the LCD, in the format provided
void lcdPrint(unsigned char variable, unsigned char format);

// Send a message to the LCD
void sendMessage(unsigned char column, unsigned char row, const unsigned char *messagePtr);

#endif
